********************************************************************************
*
**#	Table 9: Post Case Outcomes, by Court Assignment and Prosecutorial Dismissal	
*		
********************************************************************************


********************************************************************************
*
**##	Panel A -- Victims General Court 
*		
********************************************************************************

use "${DATA}/data_VICTIMS.dta", clear

# d ;

eststo clear 	;
estimates clear ; 
local m = 1  	;


local y  		revict_3 revict_3_warrant refused_coop ;

eststo t9_`m': 	estpost tabstat `y' if dismissed_retired==1 & dv_judge == 0, 
				statistics(mean ) c(s) ;	
				
				local m `++m' ;

eststo t9_`m': 	estpost tabstat `y' if dismissed_retired==0 & dv_judge == 0, 
				statistics(mean ) c(s) ;
				
				local m `++m' ;

eststo t9_`m': 	estpost ttest `y' if dv_judge == 0, by(dismissed_retired) ;

				local m `++m' ;	

esttab t9_*  	using "${OUTPUT}/tab9.csv",  label  replace
				title("Non DV Court")
				mtitle("Dismissed" "Non-Dismissed" "p-value") collabels(none) 
				cells("mean(pattern(1 1 0) fmt(2)) p(par pattern(0 0 1) fmt(2))") 
				varlabels(`e(labels)') varwidth(45)	 nonotes noobs ;
				
# d cr 

********************************************************************************
*
**## 	Panel A -- Victims DV Court 
*		
********************************************************************************

# d ;

eststo clear 	;
estimates clear ; 
local m = 1  	;


local y  		revict_3 revict_3_warrant refused_coop ;

eststo t9_`m': 	estpost tabstat `y' if dismissed_retired==1 & dv_judge == 1, 
				statistics(mean ) c(s) ;	
				
				local m `++m' ;

eststo t9_`m': 	estpost tabstat  `y' if dismissed_retired==0 & dv_judge == 1,
				statistics(mean ) c(s) ;

				local m `++m'				;

eststo t9_`m': 	estpost ttest `y' if dv_judge == 1, by(dismissed_retired) ;

esttab t9_*  	using "${OUTPUT}/tab9.csv",  label  replace
				title("Non DV Court")
				mtitle("Dismissed" "Non-Dismissed" "p-value") collabels(none) 
				cells("mean(pattern(1 1 0) fmt(2)) p(par pattern(0 0 1) fmt(2))") 
				varlabels(`e(labels)') varwidth(45)	 nonotes noobs ;
							
# d cr 

********************************************************************************
*
**##	Panel B -- Defendants General Court 
*		
********************************************************************************

use "${DATA}/data_DV.dta", clear

# d ; 

eststo clear 	;
estimates clear ; 
local m = 1	  	;
		
local y  		recid_3 recid_3_dv recid_3_aslt ;

eststo t9_`m': 	estpost tabstat `y' if dismissed_retired==1 & dv_judge == 0, 
				statistics(mean ) c(s) ;
			
				local m `++m' ;

eststo t9_`m': 	estpost tabstat `y' if dismissed_retired==0 & dv_judge == 0, 
				statistics(mean ) c(s) ;
				
				local m `++m' ;

eststo d_`m': 	estpost ttest `y' if dv_judge == 0, by(dismissed_retired) ;

				local m `++m' ;	


esttab t9_*  	using "${OUTPUT}/tab9.csv", label replace
				title("Defendant Non DV Court")
				mtitle("Dismissed" "Non-Dismissed" "p-value") collabels(none) 
				cells("mean(pattern(1 1 0) fmt(2)) p(par pattern(0 0 1) fmt(2))") 
				varlabels(`e(labels)') varwidth(45)	nonotes	noobs ;
 
# d ; 

********************************************************************************
*
**## 	Pane B -- Defendants DV Court 
*		
********************************************************************************

# d ; 

eststo clear 	;
estimates clear ; 
local m = 1  	;

local y  		recid_3 recid_3_dv recid_3_aslt  ;

eststo t9_`m': 	estpost tabstat `y' if dismissed_retired==1 & dv_judge == 1, 
				statistics(mean ) c(s) ;	
				
				local m `++m' ;

eststo t9_`m': 	estpost tabstat `y' if dismissed_retired==0 & dv_judge == 1,
				statistics(mean ) c(s) ;
				
				local m `++m' ;

eststo t9_`m': 	estpost ttest `y' if dv_judge == 1, by(dismissed_retired) ;

				local m `++m' ;	


esttab t9_*  	using "${OUTPUT}/tab9.csv", label replace
				title("Defendant DV Court")
				mtitle("Dismissed" "Non-Dismissed" "p-value") collabels(none) 
				cells("mean(pattern(1 1 0) fmt(2)) p(par pattern(0 0 1) fmt(2))") 
				varlabels(`e(labels)') varwidth(45)	nonotes	noobs ;
 
				
# d cr  

********************************************************************************
*   End of File
********************************************************************************					
